<html>
<head><meta charset="utf-8"><title>box_syntax custom allocator · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html">box_syntax custom allocator</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228131093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228131093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228131093">(Feb 28 2021 at 13:35)</a>:</h4>
<p>Can box_syntax be used with a custom allocator, or does it always use the <code>Global</code> allocator like <code>Box::new()</code> does?</p>



<a name="228131860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228131860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228131860">(Feb 28 2021 at 13:50)</a>:</h4>
<p>nvm, tried it out on the <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=515c6da90e25e8ed6ba15e7aa52e41dd">playground</a> and it turns out that <code>Global</code> is always used.</p>



<a name="228145370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228145370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228145370">(Feb 28 2021 at 17:49)</a>:</h4>
<p>cc <a href="https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911">https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911</a></p>



<a name="228158757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228158757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228158757">(Feb 28 2021 at 21:36)</a>:</h4>
<p>So box syntax will be slowly phased out?</p>



<a name="228158879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228158879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228158879">(Feb 28 2021 at 21:38)</a>:</h4>
<p>Weird how <code>vec![]</code> still uses it then (which is why we ran into this, as box syntax wasn't handled correctly in rust-analyzer around <code>vec![]</code> type inference )</p>



<a name="228163420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228163420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228163420">(Feb 28 2021 at 23:00)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> <a href="#narrow/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator/near/228158757">said</a>:</p>
<blockquote>
<p>So box syntax will be slowly phased out?</p>
</blockquote>
<p>According to <a href="https://github.com/rust-lang/rust/issues/49733#issue-312002462">https://github.com/rust-lang/rust/issues/49733#issue-312002462</a>, it seems like the answer is yes.</p>



<a name="228163440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228163440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228163440">(Feb 28 2021 at 23:01)</a>:</h4>
<p>Though that issue is from almost three years ago, so it's possible things have changed.</p>



<a name="228226391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228226391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228226391">(Mar 01 2021 at 13:07)</a>:</h4>
<p><span class="user-mention silent" data-user-id="307537">Camelid</span> <a href="#narrow/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator/near/228163420">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> <a href="#narrow/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator/near/228158757">said</a>:</p>
<blockquote>
<p>So box syntax will be slowly phased out?</p>
</blockquote>
<p>According to <a href="https://github.com/rust-lang/rust/issues/49733#issue-312002462">https://github.com/rust-lang/rust/issues/49733#issue-312002462</a>, it seems like the answer is yes.</p>
</blockquote>
<p>The bulk of that comment is about the <code>PLACE &lt;- EXPR</code> syntax, not about box syntax. The two are related, but it doesn't really talk about the long term plan for <code>box</code>, and that comment explicitly notes that the PR removing placement syntax is <em>not</em> going to have an effect on box syntax.</p>



<a name="228342325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228342325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228342325">(Mar 02 2021 at 02:17)</a>:</h4>
<p>I thought I heard somewhere that box syntax will probably be permanently unstable, but <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="228342393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228342393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228342393">(Mar 02 2021 at 02:18)</a>:</h4>
<p>Personally I care more about box patterns since I would like to use them but also try to keep stuff on stable Rust.</p>



<a name="228364651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/box_syntax%20custom%20allocator/near/228364651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator.html#228364651">(Mar 02 2021 at 07:18)</a>:</h4>
<p><span class="user-mention silent" data-user-id="307537">Camelid</span> <a href="#narrow/stream/131828-t-compiler/topic/box_syntax.20custom.20allocator/near/228342325">said</a>:</p>
<blockquote>
<p>I thought I heard somewhere that box syntax will probably be permanently unstable, but <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>
</blockquote>
<p>(This is probably true. I just wanted to point out that I didn’t think <a href="https://github.com/rust-lang/rust/issues/49733">#49733</a> had much to do with it at this point. Or at least, the closing of <a href="https://github.com/rust-lang/rust/issues/49733">#49733</a> made it <em>less</em> likely that <code>box</code> syntax woud be permamently unstable, not more.)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>